/*	
	This do-file replicates all empirical results of the paper: The Formation of Cabinet Coalitions in Presidential Systems
	published in Latin American Politics and Society 2016

	The following analyses are based on conditional logit and mixed logit models as proposed by Martin and Stevenson (2001) and Glasgow et al. (2012) 
	for analyzing government formation in parliamentary systems. The approach focuses on government alternatives rather than individual parties 
	and has become the standard empirical method to analyze government formation in parliamentary systems.
	
	One important difference of the conditional to a standard binary logit model of government formation is that the unit of observation is neither 
	the government nor the parliamentary party but the choice set, where all potential governments are alternatives among which decision makers can choose. 	
	
	The dependent variable of interested is consequently "empgov" which indicates the empircial government coalition among all coalition alternatives.  
	
	The independent variables describe properties of coalition alternatives in terms of their legislative size and ideological composition. 
	The legislative size of potential government coalitions is mainly based on Nohlen (2005) and updated using electoral results from national electoral sources. 
	The ideological position of parties within coalition alternatives is mainly based on Wiesehomeier and Benoit (2009). 
	
	For more details please refer to the article and my PhD thesis available on request	JFreudenreich@gmail.com.
*/
set more off
use clogit_Routput_for_LAPS2016, clear
eststo clear

*****************************************************************
* TABLES
***************************************************************

* Table 1)	The Determinants of Cabinet Composition in Latin America
eststo CL_M1, title((1)): qui clogit empgov connected division medianparty extreme minority uppermin numpar if majsit==0, group(cab_id)
eststo CL_M2, title((2)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext if majsit==0, group(cab_id) 
eststo CL_M3, title((3)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin if majsit==0, group(cab_id) 
eststo CL_M4, title((4)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin, group(cab_id) 
esttab CL_M*, compress

* Table 2)	The Determinants of Minority Governments in Latin America
eststo CLim1, title((5)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin minxmed if majsit==0, group(cab_id)  
eststo CLim3, title((6)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin minxssdecree if majsit==0, group(cab_id)
eststo CLim4, title((7)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin minxssveto if majsit==0, group(cab_id)
eststo CLim5, title((8)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin minxpotcon if majsit==0, group(cab_id)
esttab CLim*, compress	

*************************************************************
* ROBUSTNESS Analyses
*************************************************************

* Table 3)	Robustness Analyses
eststo CL_X0, title((9)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin if ENPP>2.5, group(cab_id)
eststo CL_X1, title((10)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin if unicameral==0, group(cab_id)

*!!!!
*THIS TAKES A WHILE!
	estimates restore CL_M3
	*do mixed_regression
	eststo CL_X3, title("MIXED") 
*!!!


esttab CL_X*, compress unstack

* Differences of effects after presidential and midterm elections
	
	/*
	One reviewer questioned whether legislative elections should define new government formation episodes:	
	The estimations below reestimate model 3 of the paper on three subsamples. The first column does not treat legislative elections as a new government epispode, 
	which leads to the exclusion of 17 bargaining situations. The second and third column of table 2 show the estimation of model 3 based on bargaining situations
	after presidential elections and during the presidential term. As one can see, the results are similar when midterm elections are not treated to define new government episodes.
	After a presidential election the effects of pre-electoral bargaining is generally stronger than during the presidential term. Then coalitions containing 
	parties of presidential competitors are generally unlikely to be formed. Effects of variables of legislative bargaining, such as the effects of the ideological range within a coalition, are stronger during the presidential term. 
	*/

eststo CL_P1, title((3)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin if majsit==0 & onlyparl==0 , group(cab_id) 
eststo CL_P2, title((3)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin if majsit==0 & presidential_election==1, group(cab_id) 
eststo CL_P3, title((3)): qui clogit empgov connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin if majsit==0 & presidential_election==0, group(cab_id) 
esttab CL_P*, compress

* test of collinearity (Model 3)
	
	/*
	One reviewer asked for a colliniarity test: 
	A test of collinearity for model 3 is displayed below.As a general rule of thumb, a VIF>10 indicates harmful collinearity. 
	As one can see, this is not the case for my analysis.
	*/
collin connected division medianparty extreme minority uppermin numpar pecpar pecext compcan secfin if majsit==0


* test wether effects dependent on specific countries in the dataset
	
	/* 
	One reviewer asked to control for country specific effects:
	
	Country specific fixed-effects cannot be included in conditional logit models because they do not vary across alternatives and �cancel out�. 
	A simple procedure to tackle the problem of �controls for countries� is to estimate the model based on subsamples. The graphs produced by the command below 
	display the parameters of model 3 with 95 percent confidence intervals. Each parameter plot displays the estimation when one of the thirteen countries 
	in the study is excluded. The effects are significant if both the upper and lower bound of the confidence interval are above or below the zero line. 
	As one can see, the significance of the parameter of the  median party depends on the inclusion of Bolivia (which makes sense, as Bolivia is the only country, 
	where the parliament has a direct say in the formation of the government � if no candidate obtains an absolute majority in the first round of the presidential
	election, congress decided over the head of the government). Overall, however, the graphs illustrate that the results are relatively robust to the 
	exclusion of specific countries. 
	*/

	estimates restore CL_M3
	do parameter_plots

exit

Literature cited above: 

Glasgow, Garrett, Matt Golder, and Sona Golder. 2012. New Empirical Strategies for the Study of Parliamentary Government Formation. Political Analysis 20:248-270.
Martin, Lanny W., and Randolph T. Stevenson. 2001. Government Formation in Parliamentary Democracies. American Journal of Political Science 45 (1):33-50.
Nohlen, Dieter. 2005. Elections in the Americas: a Data Handbook. 2 vols. New York: Oxford University Press.
Wiesehomeier, Nina, and Kenneth Benoit. 2009. Presidents, Parties, and Policy Competition. The Journal of Politics 71 (04):1435-1447.


